package com.visionet.waveletData.web.repository.account;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.QueryHints;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.visionet.waveletData.web.entity.account.Role;

import javax.persistence.QueryHint;

public interface RoleDao extends PagingAndSortingRepository<Role, Long>, JpaSpecificationExecutor<Role>  {

    @QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value ="true") })
	Role findByName(String name);
	
	@Query("from Role where type!='A' ")
	List<Role> findCommonRole();
	@Modifying
	@Query(value="delete from c_user_role where user_id=?1",nativeQuery=true)
	void deleteByUser(Long id);

}
